package quicksort

func Quicksort(arr []int, start int, end int) {
	if start >= end {
		return
	}

	num := arr[(start+end)/2]
	i := start
	j := end

	for arr[j] > num {
		j--
	}
	for arr[i] < num {
		i++
	}

	temp := arr[i]
	arr[i] = arr[j]
	arr[j] = temp

	i++
	j--

	if i < end {
		Quicksort(arr, i, end)
	}
	if j > start {
		Quicksort(arr, start, j)
	}
}
